
<!--
/**************************************************
* @ manufactureproviderview.jsp
*
* Copyright   2005 Hitrust Technology Inc.
* Developed by SDC, Hitrust.
* All Rights Reserved.
*
* Modify History:
*  v1.00, 2006/02/11, Simonyi Peng
*  1) first release
/**************************************************
-->
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ include file="../../common.jsp" %>
<%@ taglib uri="/page.util.gs.hitrust.com/taglibs/page" prefix="page"%>
<%
			response.setHeader("Pragma", "No-cache");
			response.setHeader("Cache-Control", "no-cache,no-store,max-age=0");
			response.setDateHeader("Expires", 0);
%>
<html>
<head>
<title>供应商浏览</title>
<META http-equiv=Content-Type content="text/html; charset=UTF-8">
<LINK href="<%=root%>/css/css.css" type=text/css rel=stylesheet>
<SCRIPT language="JavaScript" src="<%=root%>/js/common.js"></SCRIPT>
<SCRIPT language="JavaScript" src="<%=root%>/js/string.js"></SCRIPT>

<%
	ArrayList tGSCountry = (ArrayList)request.getAttribute("country");
	ArrayList tGSProvince = (ArrayList)request.getAttribute("province");
	GSProvinceBean tProvinceBean = null;
	String[][] tProvDist = null;
	HashMap tMap2 = new HashMap();
	ArrayList tGSDistinct = (ArrayList)request.getAttribute("district");	
	GSDistrictBean tDistrictBean = null;
	if (tGSProvince != null) {
		for (int i = 0; i < tGSProvince.size(); i++) {
			String tProvcode = ((GSProvinceBean) tGSProvince.get(i)).getGs_province_code();
			if (tGSDistinct != null) {
				tProvDist = new String[tGSDistinct.size()][2];
				for (int j = 0; j < tGSDistinct.size(); j++) {
					tDistrictBean = (GSDistrictBean) tGSDistinct.get(j);
					if (tDistrictBean.getGs_province_code().equals(tProvcode)) {
						tProvDist[j][0] = tDistrictBean.getGs_district_code();
						tProvDist[j][1] = tDistrictBean.getGs_district_name();
						tMap2.put(tProvcode, tProvDist);
					}//end if
				}//end for
			}//end if
		}//end for
	}//end if	
	
	ResultProcess tGSProvider = (ResultProcess)request.getAttribute("provider");
	String[][] tGSCorpProperty = (String[][])request.getAttribute("corpproperty");
	ArrayList tList = new ArrayList();
%>
<script language="JavaScript">
	var counter;
	function process(){
		providerviewform.action = "<%=response.encodeURL(root+"/A100107.do")%>";
		providerviewform.submit();

	}
	
	function writeback(radiobutton){
		document.all.selectedproviderid.value=radiobutton.value;
		writebackform.action = "<%=response.encodeURL(root+"/A100108.do")%>";
		writebackform.submit();
	}
	
	//为系统维护和管理-产品管理 提供回写方法
	function backtoManufacturemanagepage(radiobutton){
	alert('hello');
		var temp = tokenize(radiobutton.value,'|');
		
		opener.document.getElementById('provider_name').value = temp[1];
		opener.document.getElementById('provider_id').value = temp[0];
	
		window.close();
	}
		
	function changedistrict(list){
		
  		var val = list;
		//for(var i=0; i<list.options.length; i++) {
		//	if(list.options[i].selected && list.options[i].value != "") {
		//		val=list.options[i].value;
		//		break;
		//	}
		//}
		if(val=='00'){
			var listbox = document.getElementById("list3");
			listbox.length = 0;
			var option = new Option();
			option.text = "---请选择城市---";
			option.value = "0000";			
			listbox.options[listbox.length] = option;

		}else{
  	<%
  		if(tMap2 !=null){
	 	   	Collection tCollection = tMap2.keySet();
	        Iterator tIterator = tCollection.iterator();
  		       while(tIterator.hasNext()){
  		           String tKey = (String)tIterator.next();
  		           String[][] tDist = (String[][])tMap2.get(tKey);
  	%>
  				if(val == '<%=tKey%>'){
	  				var counter;
	  				var listbox = document.getElementById("list3");
	  				listbox.length = 0;  		  	  								
	<%					
						for(int n=0;n<tDist.length;n++){
						    String distCode = tDist[n][0];
						    String distName = tDist[n][1];
						    if(distCode != null){
	%>				
							var temp1 = '<%=distCode%>';
							var temp2 = '<%=distName%>';
							var option = new Option();
							option.value = temp1;
							option.text = temp2;
							listbox.options[listbox.length] = option;						
	<%
						    }
						}
	%>
  				}
  	<%
  		    }
  		       
  		}
  	%>
  	}	
	}
</script>
</head>
<body BGCOLOR="#f2f2f2"	text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form name="providerviewform" method="get" >

<p><br></p>
<br>
<table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
	<tr> 
		<td> 
			<table class=bg_table id=tableId	cellspacing=1 cellpadding=0 style="padding-left:5;padding-right:5" width=100% align=center border=0>
				<TR height=20>
					<TD class="bg_column" align=center>供应商编号</TD>
					<TD align=left class="bg_row_odd"><input type="text" name="providerId" value="<%=request.getParameter("providerId")==null? "":request.getParameter("providerId") %>"></TD>					
					<TD class="bg_column" align=center>供应商名称</TD>
					<TD align=left class="bg_row_odd"><input type="text" name="providerName" value="<%=request.getParameter("providerName")==null? "":request.getParameter("providerName") %>"></TD>					
				</TR>
				<TR height=20>
					<TD class="bg_column" align=center>国家</TD>
					<TD left=right class="bg_row_odd">
						<select name="countryCode">					
						<%
							if(tGSCountry != null && tGSCountry.size() > 0 ){
								for(int i=0; i<tGSCountry.size(); i++){
								    GSCountryBean tGSCountryBean = (GSCountryBean)tGSCountry.get(i);
						%>
								<option value="<%=tGSCountryBean.getGs_en_country_name()%>"><%=tGSCountryBean.getGs_country_name()%></option>
						<%			
								}
							}else{
						%>
								<option value="00">------无------</option>
						<%
							}
						%>
						</select>
					</TD>
					<TD class="bg_column" align=center>省份</TD>
					<TD left=right class="bg_row_odd" >
						<select name="provinceCode" onChange="changedistrict(this.value)">	
						<option value="00">---请选择省份---</option>				
						<%
							String tProvCode = request.getParameter("provinceCode");
							if(tGSProvince != null && tGSProvince.size() > 0 ){
								for(int i=0; i<tGSProvince.size(); i++){
								    GSProvinceBean tGSProvinceBean = (GSProvinceBean)tGSProvince.get(i);
								    if(tProvCode != null && tProvCode.equals(tGSProvinceBean.getGs_province_code())){
						%>
								<option value="<%=tGSProvinceBean.getGs_province_code()%>" selected><%=tGSProvinceBean.getGs_province_name()%></option>
						<%			        
								    }else{
						%>
								<option value="<%=tGSProvinceBean.getGs_province_code()%>"><%=tGSProvinceBean.getGs_province_name()%></option>
								
						<%			}	
								}
							}
						%>

						</select>
					</TD>					
				</TR>
				<TR height=20>
					<TD class="bg_column" align=center>城市</TD>
					<TD left=right class="bg_row_odd">
						<select name="districtCode" id="list3">	
						<option value="0000">---请选择城市---</option>	
						<%
							String tDistrCode = request.getParameter("districtCode");
							if(tProvCode != null && !tProvCode.equals("00")){
							    String[][] temp = (String[][])tMap2.get("SH");
							    if(temp != null && temp.length > 0){
								    for(int i=0; i<temp.length; i++){
								   		if(tDistrCode != null && tDistrCode.equals(temp[i][0])){ 
							%>
											<option value="<%=temp[i][0]%>" selected><%=temp[i][1]%></option>																						
							<%		       
								   		}else if(temp[i][0] != null){
							%>
											<option value="<%=temp[i][0]%>"><%=temp[i][1]%></option>
							<%
								   		}
								    }
							    }
							}
						%>				
																		
						</select>
					</TD>
					<TD class="bg_column" align=center>公司性质</TD>
					<TD left=right class="bg_row_odd">
						<select name="corpProperty">	
						<option value="0">---全部---</option>				
						<%
							String tProperty = request.getParameter("corpProperty");
							if(tGSCorpProperty != null && tGSCorpProperty.length > 0){
								for(int i=0; i<tGSCorpProperty.length; i++){
									String[] tStr = tGSCorpProperty[i];
									if(tProperty != null && tProperty.equals(tStr[0])){
						%>
								<option value="<%=tStr[0]%>" selected><%=tStr[1]%></option>	
						<%					    
									}
						%>
								<option value="<%=tStr[0]%>"><%=tStr[1]%></option>
						<%			
								}
							}
						%>

						</select>
					</TD>					
				</TR>
                        <%
                        if(tGSProvider != null) {
                            int totalRecords = 0;
                            if(request.getAttribute("totalRecords")!=null){
                                totalRecords=Integer.parseInt((String)request.getAttribute("totalRecords"));
                            }
                            int defaultPageSize =10;
                            if(request.getAttribute("pageSize")!=null){
                                defaultPageSize=Integer.parseInt((String)request.getAttribute("pageSize"));
                            }
                            totalRecords=tGSProvider.getRecordsSize();
                        %>          
                        <page:pager total='<%=totalRecords%>' defaultPageSize='<%=defaultPageSize%>'>
                        <%tList = tGSProvider.getDisplayRecords(index.intValue(),pageSize.intValue()); %>
                        </page:pager>
                        <%} %>				
			</table>
		</td>
	</tr>
</table>
</form>
    <p align="center">  
		<input type="image" src="images/button/chaxun.gif" width="58" height="24" class="box" onclick="process()"/>&nbsp;
    </p>
<%
	
	if(tGSProvider != null){
%>
	<center>
    <table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
		<tr>
			<td>
            <form name='pager' method="post">
            	<table class=bg_table id=tableId	cellspacing=1 cellpadding=2 width=100% align=center border=0>
                    <tbody> 
                    <tr class="bg_column" height=20>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">&nbsp;</div>
						</td>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">供应商编号</div>
						</td>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">供应商名称</div>
						</td>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">负责人</div>
						</td>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">负责人电话</div>
						</td>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">公司性质</div>
						</td>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">经营范围</div>
						</td>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">信誉等级</div>
						</td>																																				
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">详细信息</div>
						</td>																	
					</tr>
					<%
						if(tList != null && tList.size() > 0){
						for(int i=0; i<tList.size(); i++){
							String[] tStr = (String[])tList.get(i);
							String tTempStr="";
							if(i%2==0){
								tTempStr="class=\"bg_row_odd\"";
							}else {
								tTempStr="class=\"bg_row_even\"";
							}
					%>
							<tr <%=tTempStr%> height=20>
								<td class=top align=middle> 
									<div align="center" class="txt_content">
									<input type="radio" name="index" value="<%=tStr[0]+"|"+tStr[1]%>" onclick="backtoManufacturemanagepage(this);">
									</div>
								</td>	
								<td class=top align=middle> 
									<div align="center" class="txt_content">
									<%=tStr[0]%>
									</div>
								</td>	
								<td class=top align=middle> 
									<div align="center" class="txt_content">
									<%=tStr[1]%>
									</div>
								</td>								
								<td class=top align=middle> 
									<div align="center" class="txt_content">
									<%=tStr[2]%>
									</div>
								</td>
								<td class=top align=middle> 
									<div align="center" class="txt_content">
									<%=tStr[3]%>
									</div>
								</td>								
								<td class=top align=middle> 
									<div align="center" class="txt_content">
									<%=tStr[4]%>
									</div>
								</td>								
								<td class=top align=middle> 
									<div align="center" class="txt_content">
									<%=tStr[5]%>
									</div>
								</td>															
								<td class=top align=middle> 
									<div align="center" class="txt_content">
									<%=tStr[6]%>
									</div>
								</td>																
								<td class=top align=middle> 
									<div align="center" class="txt_content">
									<a href="<%=response.encodeURL(root+"/A100109.do")%>?providerId=<%=tStr[0]%>">详细</a>
									</div>
								</td>																	
							</tr> 
							
					<%	
							}
					%>
						  <tr class="bg_column" height=20>
						    <td width="960" height="16" colspan="9" align="right">
									<!--导航条-->
						    		<page:navigator type='text' queryForm='providerviewform'/>
						    </td>
						  
				    <%
						}else{
					%>
							<font color="red">没有符合条件的供应商</font>
					<%
						}
					%>
					</tbody>
				</table>
				</form>					  
			</td>
		</tr>
	</table>
	</center>
<%		
	}
%>

<form name='writebackform' ><input type='hidden' name='selectedproviderid' id='selectedproviderid'></form>
</body>
</html>